package interview.concurrency;

import java.util.concurrent.BlockingQueue;

/**
 * @author fance
 * @date 2018/7/10 16:45
 */
public class Producer implements  Runnable {
    BlockingQueue<String> queue;

    public Producer(BlockingQueue<String> queue) {
        this.queue = queue;
    }

    @Override
    public void run() {

        try {
            String tmp = "a product, : " + Thread.currentThread().getName();
            System.out.println("i have made a product : " + Thread.currentThread().getName());
            queue.put(tmp);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
